<?php
$GLOBALS['PAGE_FORM_DATA'] = array();
$act = isset($_REQUEST['act'])?$_REQUEST['act']:'';
$dt = new DataTable(constant('DB_TABLE_EPAPER_CONTENT'));
if ( $act == 'save') {
	$row_data = $_REQUEST;
	if ( !isset($row_data['id']) || intval($row_data['id'])==0) {
		$row_data['date'] = date('Y-m-d H:i:s');
	}
	$dt->save($row_data);
	ob_clean();
	$redirect_url = 'epaper.php';
	header('Location:'.$redirect_url);
	exit();
}
else if ( $act == 'edit' )
{
	$GLOBALS['PAGE_FORM_DATA'] = $dt->get($_REQUEST['id']);
}
else {
	$GLOBALS['PAGE_FORM_DATA']['id'] = 0;

	$GLOBALS['PAGE_FORM_DATA']['subject'] = '';
	$GLOBALS['PAGE_FORM_DATA']['content'] = '';
}
?>